// Copyright 2021-present StarRocks, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This file is based on code available under the Apache license here:
//   https://github.com/apache/incubator-doris/blob/master/gensrc/proto/palo_internal_service.proto

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

// NOTE(XXX): DEPRECATED, just use to compatible with old version.
// Make system can grayscale upgrade
syntax="proto2";

import "internal_service.proto";

package doris;
option java_package = "com.starrocks.proto";

option cc_generic_services = true;

service PBackendService {
    rpc transmit_data(starrocks.PTransmitDataParams) returns (starrocks.PTransmitDataResult);
    rpc exec_plan_fragment(starrocks.PExecPlanFragmentRequest) returns (starrocks.PExecPlanFragmentResult);
    rpc exec_batch_plan_fragments(starrocks.PExecBatchPlanFragmentsRequest) returns (starrocks.PExecBatchPlanFragmentsResult);
    rpc cancel_plan_fragment(starrocks.PCancelPlanFragmentRequest) returns (starrocks.PCancelPlanFragmentResult);
    rpc fetch_data(starrocks.PFetchDataRequest) returns (starrocks.PFetchDataResult);
    rpc tablet_writer_open(starrocks.PTabletWriterOpenRequest) returns (starrocks.PTabletWriterOpenResult);
    rpc tablet_writer_add_batch(starrocks.PTabletWriterAddBatchRequest) returns (starrocks.PTabletWriterAddBatchResult);
    rpc tablet_writer_cancel(starrocks.PTabletWriterCancelRequest) returns (starrocks.PTabletWriterCancelResult);
    rpc trigger_profile_report(starrocks.PTriggerProfileReportRequest) returns (starrocks.PTriggerProfileReportResult);
    rpc collect_query_statistics(starrocks.PCollectQueryStatisticsRequest) returns (starrocks.PCollectQueryStatisticsResult);
    rpc get_info(starrocks.PProxyRequest) returns (starrocks.PProxyResult);
    rpc get_pulsar_info(starrocks.PPulsarProxyRequest) returns (starrocks.PPulsarProxyResult);
    rpc get_file_schema(starrocks.PGetFileSchemaRequest) returns (starrocks.PGetFileSchemaResult);
    rpc exec_short_circuit(starrocks.PExecShortCircuitRequest) returns (starrocks.PExecShortCircuitResult);

    // Transmit vectorized data between backends
    rpc transmit_chunk(starrocks.PTransmitChunkParams) returns (starrocks.PTransmitChunkResult);
    rpc transmit_chunk_via_http(starrocks.PHttpRequest) returns (starrocks.PTransmitChunkResult);
    rpc tablet_writer_add_chunk(starrocks.PTabletWriterAddChunkRequest) returns (starrocks.PTabletWriterAddBatchResult);
    rpc tablet_writer_add_chunks(starrocks.PTabletWriterAddChunksRequest) returns (starrocks.PTabletWriterAddBatchResult);
    rpc tablet_writer_add_segment(starrocks.PTabletWriterAddSegmentRequest) returns (starrocks.PTabletWriterAddSegmentResult);
    rpc transmit_runtime_filter(starrocks.PTransmitRuntimeFilterParams) returns (starrocks.PTransmitRuntimeFilterResult);

    // NOTE(murphy) check if it's really necessary
    rpc submit_mv_maintenance_task(starrocks.PMVMaintenanceTaskRequest) returns (starrocks.PMVMaintenanceTaskResult);

    // local tablet reader
    rpc local_tablet_reader_open(starrocks.PTabletReaderOpenRequest) returns (starrocks.PTabletReaderOpenResult);
    rpc local_tablet_reader_close(starrocks.PTabletReaderCloseRequest) returns (starrocks.PTabletReaderCloseResult);
    rpc local_tablet_reader_multi_get(starrocks.PTabletReaderMultiGetRequest) returns (starrocks.PTabletReaderMultiGetResult);
    rpc local_tablet_reader_scan_open(starrocks.PTabletReaderScanOpenRequest) returns (starrocks.PTabletReaderScanOpenResult);
    rpc local_tablet_reader_scan_get_next(starrocks.PTabletReaderScanGetNextRequest) returns (starrocks.PTabletReaderScanGetNextResult);

    rpc execute_command(starrocks.ExecuteCommandRequestPB) returns (starrocks.ExecuteCommandResultPB);
    rpc update_fail_point_status(starrocks.PUpdateFailPointStatusRequest) returns (starrocks.PUpdateFailPointStatusResponse);
    rpc list_fail_point(starrocks.PListFailPointRequest) returns (starrocks.PListFailPointResponse);

    rpc process_dictionary_cache(starrocks.PProcessDictionaryCacheRequest) returns (starrocks.PProcessDictionaryCacheResult);
};
